home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Tools / ResAnomaly 1.2 ƒ / ResAnomaly Source / StFile.h < prev   
C/C++ Source or Header  |  1995-07-03  |  1KB  |  55 lines

  1. #pragma once
  2.  
  3. // StFile.h
  4. // ©1995 Chris K. Thomas & Rob Guttman.  All Rights Reserved.
  5.  
  6. // • ckt 2 July 1995 - added args per Rob for StandardFile bug fixes.
  7.  
  8. // Highest Level Interface to StandardFile possible.
  9. // basically just encapsulates the functionality
  10. // into a class.
  11.  
  12. // Note:  StandardFile is really unentertaining, so I'd try
  13. //             to avoid it wherever possible.
  14. //        If you're lynched by irate users, don't blame me.
  15.  
  16. struct SFR
  17. {
  18.     StandardFileReply reply;
  19. };
  20.  
  21. struct StGetFile :public SFR
  22. {
  23.     StGetFile(const short numTypes, OSType inTypes[1])
  24.     {
  25.         StandardGetFile(NULL, numTypes, inTypes, &reply);
  26.     }
  27. };
  28.  
  29. struct StPutFile :public SFR
  30. {
  31.     // * normal StandardPutFile
  32.     StPutFile(ConstStr255Param prompt, ConstStr255Param defaultName)
  33.     {
  34.         DebugStr("\pFSSpec, dammit");
  35.         StandardPutFile(prompt, defaultName, &reply);
  36.     }
  37.     
  38.     // * alternate accepting default file location
  39.     StPutFile(ConstStr255Param prompt, ConstStr255Param defaultName,
  40.                                             long dirID, short volumeRefNum)
  41.     {
  42.         LMSetCurDirStore( dirID );
  43.         LMSetSFSaveDisk( volumeRefNum );
  44.         StandardPutFile( prompt, defaultName, &reply );
  45.     }
  46.     
  47.     // * this constructor is the same as the above, only taking arguments
  48.     // * from a FSSpec, which is a logical structure in which to store them
  49.     StPutFile(ConstStr255Param prompt, FSSpec &inSpec)
  50.     {
  51.         LMSetSFSaveDisk( inSpec.vRefNum );
  52.         LMSetCurDirStore( inSpec.parID );
  53.         StandardPutFile( prompt, inSpec.name, &reply );
  54.     }
  55. };